var nextNum;
export function getCalendar(year,month){
	console.log(year,month);
	let daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
	if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
	    daysInMonth[1] = 29;
	}
	// 获得指定年月的1号是星期几
	let targetDay = new Date(year, month, 1).getDay();
	// 将要在calendar__main中渲染的列表
	let total_calendar_list = [];
	let preNum = targetDay;
	// 首先先说一下，我们的日期是(日--六)这个顺序也就是(0--6)
	// 有了上述的前提我们可以认为targetDay为多少，我们就只需要在total_calendar_list的数组中push几个content为''的obj作为占位
	if (targetDay > 0) {
	    for (let i = 0; i < preNum; i++) {
	        let obj = {
	            type: "pre",
	            content: ""
	        };
	        total_calendar_list.push(obj);
	    }
	}

	for (let i = 0; i < daysInMonth[month]; i++) {
	    let obj = {
	        type: "normal",
	        content: (month+1)+'月'+(i + 1)+'日',
	    };
	    total_calendar_list.push(obj);
	}
	if (total_calendar_list.length > 35) {
	    nextNum = 42 - total_calendar_list.length;
	} else {
	    nextNum = 35 - total_calendar_list.length;
	}
	// 与上面的type=pre同理
	for (let i = 0; i < nextNum; i++) {
	    let obj = {
	        type: "next",
	        content: ""
	    };
	    total_calendar_list.push(obj);
	}

	let result = []
  for(let k in total_calendar_list){
		let o = {...total_calendar_list[k]}
		if(o.type !== 'normal'){
			continue;
		}
    if(k % 7 == 0){
      o.day = '周日'
    } else if(k % 7 == 1){
      o.day = '周一'
    } else if(k % 7 == 2){
      o.day = "周二"
    } else if(k % 7 == 3){
      o.day = "周三"
    } else if(k % 7 == 4){
      o.day = "周四"
    } else if(k % 7 == 5){
      o.day = "周五"
    } else if(k % 7 == 6){
      o.day = "周六"
    }
    result.push(o)
	}
	
	return result;
}